let a:number = 1;

let b:string = '1';

// console.log(a + b);

function sum(x:number,y:number):number
{
    return x + y;
}

// console.log(sum(a,b));

// function demo(name:string,gender?:number):void
// {
//     console.log(name);

//     // return undefined;
// }

// demo('demo');

// 变量 c 类型可以是string | number
let c:(string|number) = '';

// c = false;

// 声明变量时，不确认变量到底是什么类型，在赋值时决定
let d:unknown = 123;

// d = '123';

// d.toString();

// any表示任意类型
let e:any = 123;

e.toString();

type MobileType = string

interface Business{
    id:number;
    nickname:string;
    mobile:MobileType;
}

interface Business{
    gender:number;
}

type BusinessType = {
    id:number;
    nickname:string;
    mobile:string;
}

let business:Business = {
    id:1,
    nickname:'demo',
    mobile:'13800000',
    gender:1
}

let business2:Business = {

}

console.log(business);

function demo<T>(item: T[]): T[]
{
    return new Array<T>().concat(item)
}

demo([1])

function demo3<T, U>(id:T, name:U): void
{
    console.log(typeof(id) + ", " + typeof(name))
}

demo3<boolean,string>(false,'demo');